using UnityEngine;
using UnityEngine.UI;

namespace Project
{
    public class BuffInfoBox : MonoBehaviour
    {
        private Text mDescription;
        private Image mIcon;
        private RectTransform mSelf;

        private void Awake()
        {
            mIcon = transform.Find("BuffIcon").GetComponent<Image>();
            mDescription = GetComponentInChildren<Text>();
            mSelf = transform as RectTransform;
        }
        public void Show(Sprite sprite, string description)
        {
            gameObject.SetActive(true);
            mIcon.sprite = sprite;
            mDescription.text = description;            
        }
        public void Hide()
        {
            gameObject.SetActive(false);
        }
        public void Move(Vector2 pos)
        {
            pos -= mSelf.sizeDelta;
            mSelf.anchoredPosition = pos;
        }
    }
}